﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Managers_Admin.aspx.cs"
    Inherits="CarServiseSite.Managers_Admin" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script src="http://code.jquery.com/jquery-1.4.4.js"></script>
    <link href="./style-template.css" rel="stylesheet" type="text/css">
    <title></title>
</head>
<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor="#FFFFFF">
    <form id="form1" runat="server">
    <div>
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
            <tbody>
                <tr>
                    <td valign="top" width="542">
                        <img src="./images/pic01.jpg" height="131" width="542">
                    </td>
                    <td height="131" valign="top" align="left">
                        <img src="./images/logo.gif" height="131" width="228">
                    </td>
                </tr>
                <tr valign="top">
                    <td colspan="2" height="41">
                        <table width="770" border="0" cellpadding="0" cellspacing="0">
                            <tbody>
                                <tr>
                                    <td width="1%">
                                        <img src="./images/SPACER.GIF" height="41" width="12">
                                    </td>
                                    <td valign="middle" width="99%">
                                        <asp:Menu ID="Menu5" runat="server" BorderStyle="Ridge" BorderWidth="1px" ItemWrap="True"
                                            Orientation="Horizontal" StaticSubMenuIndent="">
                                            <DynamicMenuItemStyle BorderStyle="Double" BorderWidth="1px" />
                                            <DynamicItemTemplate>
                                                <%# Eval("Text") %>
                                            </DynamicItemTemplate>
                                            <Items>
                                                <asp:MenuItem NavigateUrl="~/Admins_Admin.aspx" Text="Администраторы" Value="Admins">
                                                </asp:MenuItem>
                                                <asp:MenuItem NavigateUrl="~/Clients_Admin.aspx" Text="Клиенты" Value="Clients">
                                                </asp:MenuItem>
                                                <asp:MenuItem NavigateUrl="~/Managers_Admin.aspx" Text="Менеджеры" Value="Managers">
                                                </asp:MenuItem>
                                                <asp:MenuItem NavigateUrl="~/Workers_Admin.aspx" Text="Работники" Value="Workers">
                                                </asp:MenuItem>
                                                <asp:MenuItem NavigateUrl="~/WorkType_Admin.aspx" Text="Типы работ" Value="WorkType">
                                                </asp:MenuItem>
                                            </Items>
                                            <StaticMenuItemStyle BackColor="#185490" Font-Bold="True" ForeColor="White" Height="60px"
                                                HorizontalPadding="10px" />
                                            <StaticMenuStyle Width="758px" />
                                        </asp:Menu>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
            </tbody>
        </table>
        <table height="100%" width="770" bgcolor="185490" border="0" cellpadding="2" cellspacing="1">
            <tbody>
                <tr>
                    <td height="40" valign="middle" align="left" bgcolor="2792FF">
                        Менеджеры
                        <div align="right">
                            <asp:Button ID="ButtonExit" runat="server" Text="Выход" onclick="ButtonExit_Click" />
                        </div>
                    </td>
                </tr>
                <tr>
                    <td valign="top" align="left" bgcolor="DAECFF">
                        <table class="text" height="100%" width="95%" border="0" cellpadding="5" cellspacing="0">
                            <tbody>
                                <tr>
                                    <td valign="top">
                                        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
                                            AutoGenerateColumns="False" DataKeyNames="ManagerID" DataSourceID="ManagersDataSource"
                                            EnableModelValidation="True" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None"
                                            BorderWidth="1px" CellPadding="3">
                                            <Columns>
                                                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                                                <asp:BoundField DataField="ManagerID" HeaderText="ManagerID" InsertVisible="False"
                                                    ReadOnly="True" SortExpression="ManagerID" />
                                                <asp:BoundField DataField="Surname" HeaderText="Surname" 
                                                    SortExpression="Surname" />
                                                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                                                <asp:BoundField DataField="Patronymic" HeaderText="Patronymic" 
                                                    SortExpression="Patronymic" />
                                                <asp:BoundField DataField="Login" HeaderText="Login" SortExpression="Login" />
                                                <asp:BoundField DataField="UID" HeaderText="UID" SortExpression="UID" />
                                                <asp:BoundField DataField="INN" HeaderText="INN" SortExpression="INN" />
                                                <asp:BoundField DataField="KPP" HeaderText="KPP" SortExpression="KPP" />
                                                <asp:BoundField DataField="OGRN" HeaderText="OGRN" SortExpression="OGRN" />
                                                <asp:BoundField DataField="Adress" HeaderText="Adress" 
                                                    SortExpression="Adress" />
                                                <asp:BoundField DataField="Telephone" HeaderText="Telephone" 
                                                    SortExpression="Telephone" />
                                                <asp:BoundField DataField="Mail" HeaderText="Mail" SortExpression="Mail" />
                                            </Columns>
                                            <FooterStyle BackColor="White" ForeColor="#000066" />
                                            <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                                            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                                            <RowStyle ForeColor="#000066" />
                                            <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                                        </asp:GridView>
                                        <asp:SqlDataSource ID="ManagersDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:CarServiceConnectionString %>"
                                            DeleteCommand="DELETE FROM [Managers] WHERE [ManagerID] = @ManagerID" InsertCommand="INSERT INTO [Managers] ([Surname], [Name], [Patronymic], [Login], [Password], [UID], [INN], [KPP], [OGRN], [Adress], [Telephone], [Mail]) VALUES (@Surname, @Name, @Patronymic, @Login, @Password, @UID, @INN, @KPP, @OGRN, @Adress, @Telephone, @Mail)"
                                            SelectCommand="SELECT * FROM [Managers]" 
                                            UpdateCommand="UPDATE [Managers] SET [Surname] = @Surname, [Name] = @Name, [Patronymic] = @Patronymic, [Login] = @Login, [Password] = @Password, [UID] = @UID, [INN] = @INN, [KPP] = @KPP, [OGRN] = @OGRN, [Adress] = @Adress, [Telephone] = @Telephone, [Mail] = @Mail WHERE [ManagerID] = @ManagerID">
                                            <DeleteParameters>
                                                <asp:Parameter Name="ManagerID" Type="Int32" />
                                            </DeleteParameters>
                                            <InsertParameters>
                                                <asp:Parameter Name="Surname" Type="String" />
                                                <asp:Parameter Name="Name" Type="String" />
                                                <asp:Parameter Name="Patronymic" Type="String" />
                                                <asp:Parameter Name="Login" Type="String" />
                                                <asp:Parameter Name="Password" Type="String" />
                                                <asp:Parameter Name="UID" Type="String" />
                                                <asp:Parameter Name="INN" Type="String" />
                                                <asp:Parameter Name="KPP" Type="String" />
                                                <asp:Parameter Name="OGRN" Type="String" />
                                                <asp:Parameter Name="Adress" Type="String" />
                                                <asp:Parameter Name="Telephone" Type="String" />
                                                <asp:Parameter Name="Mail" Type="String" />
                                            </InsertParameters>
                                            <UpdateParameters>
                                                <asp:Parameter Name="Surname" Type="String" />
                                                <asp:Parameter Name="Name" Type="String" />
                                                <asp:Parameter Name="Patronymic" Type="String" />
                                                <asp:Parameter Name="Login" Type="String" />
                                                <asp:Parameter Name="Password" Type="String" />
                                                <asp:Parameter Name="UID" Type="String" />
                                                <asp:Parameter Name="INN" Type="String" />
                                                <asp:Parameter Name="KPP" Type="String" />
                                                <asp:Parameter Name="OGRN" Type="String" />
                                                <asp:Parameter Name="Adress" Type="String" />
                                                <asp:Parameter Name="Telephone" Type="String" />
                                                <asp:Parameter Name="Mail" Type="String" />
                                                <asp:Parameter Name="ManagerID" Type="Int32" />
                                            </UpdateParameters>
                                        </asp:SqlDataSource>
                                        <br />
                                        <div id="clickme">
                                            Добавление менеджера
                                        </div>
                                        <br />
                                        <div id="updown">
                                            <table>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="Label6" runat="server" Text="Фамилия"></asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                                                    </td>
                                                    <td>
                                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
                                                            ErrorMessage="Поле не может быть пустым" ValidationGroup="1"></asp:RequiredFieldValidator>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="Label2" runat="server" Text="Имя"></asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                                                    </td>
                                                    <td>
                                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox2"
                                                            ErrorMessage="Поле не может быть пустым" ValidationGroup="1"></asp:RequiredFieldValidator>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="Label3" runat="server" Text="Отчество"></asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                                                    </td>
                                                    <td>
                                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="TextBox3"
                                                            ErrorMessage="Поле не может быть пустым" ValidationGroup="1"></asp:RequiredFieldValidator>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="Label4" runat="server" Text="Логин"></asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
                                                    </td>
                                                    <td>
                                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="TextBox4"
                                                            ErrorMessage="Поле не может быть пустым" ValidationGroup="1"></asp:RequiredFieldValidator>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="Label5" runat="server" Text="Пароль"></asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="TextBox5" runat="server" TextMode="Password"></asp:TextBox>
                                                    </td>
                                                    <td>
                                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="TextBox5"
                                                            ErrorMessage="Поле не может быть пустым" ValidationGroup="1"></asp:RequiredFieldValidator>
                                                    </td>
                                                </tr>
                                            </table>
                                            <asp:Button ID="Button1" ValidationGroup=1 runat="server" OnClick="Button1_Click1" Text="Добавить" />
                                        </div>
                                        <script>
                                            $("#clickme").click(function () {
                                                $("#updown").slideToggle("slow");
                                            });
                                        </script>
                                        <script>
                                            $('#updown').hide();
                                        </script>
                                        <br />
                                        <asp:Label ID="ErrorLabel" runat="server"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td height="25" valign="bottom" align="center">
                                        Powered by Fifth Wheel 2011.
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    </form>
</body>
</html>
